﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.IO;

using ECCIT;
using ECCIT.Extension.Weibo_v2.Model;
using ECCIT.Extension.Weibo_v2.Common;

using OgilvyOne.UKNow.BLL;
using OgilvyOne.UKNow.Model;
using OgilvyOne.UKNow.Configuration;
using OgilvyOne.UKNow.Mobile.Model;
using OgilvyOne.UKNow.Mobile.Utilities;

namespace OgilvyOne.UKNow.Mobile.APIs.Comments
{
    public class getCommentByUserID:IHttpHandler
    {
        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                //string sPageSize = context.Request.Params["page_size"];
                //string sCurrPageIndex = context.Request.Params["current_page"];
                //string sUid = context.Request.Params["uid"];

                //if (string.IsNullOrEmpty(sUid)) throw new ArgumentNullException("uid");
                //int pageSize = 10;
                //if (!string.IsNullOrEmpty(sPageSize))
                //    pageSize = int.Parse(sPageSize);

                //int currPageIndex = 1;
                //if (!string.IsNullOrEmpty(sCurrPageIndex))
                //    currPageIndex = int.Parse(sCurrPageIndex);

                //int uid = int.Parse(sUid);

                //EventsBLL bll = new EventsBLL(2052);
                //PagingList list = bll.GetMyEvents(uid, pageSize, currPageIndex);
                //CalendarEventsInfo cei = new CalendarEventsInfo();
                //cei.Events = list.List.Cast<FavoriteEventsModel>().ToList<FavoriteEventsModel>();
                //cei.Events.ForEach(delegate(FavoriteEventsModel model)
                //{
                //    if (!string.IsNullOrEmpty(model.COL_EVENTS_LB_IMG))
                //        model.COL_EVENTS_LB_IMG = ConfigCacheManager.DomainName + ConfigCacheManager.FilePath.GetImageVirtualPath(model.COL_EVENTS_LB_IMG);

                //    if (!string.IsNullOrEmpty(model.COL_HTML_FILE_NAME))
                //        model.COL_HTML_FILE_NAME = ConfigCacheManager.DomainName + "/cn/events/" + model.COL_HTML_FILE_NAME;
                //    else
                //        model.COL_HTML_FILE_NAME = string.Format("{0}/cn/events/{1}.html", ConfigCacheManager.DomainName, model.COL_EVENTS_ID);
                //});
                //cei.CurrentPageIndex = currPageIndex;
                //cei.PageCount = list.Capacity % pageSize == 0 ? list.Capacity / pageSize : list.Capacity / pageSize + 1;
                //cei.TotalCount = list.Capacity;
                //string s = JsonSerializationHelper.ObjectToJson(cei);
                //context.Response.Write(ResultUtility.ReturnResultJson("0", s, "获取我的收藏活动列表成功"));
            }
            catch (Exception ex)
            {
                context.Response.Write(ResultUtility.ReturnResultJson("-100", "", "获取我的收藏活动列表失败. Message:" + ex.Message));
            }
        }
    }
}
